package com.qf.dao;

import com.qf.pojo.entity.Permission;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @ClassName PermissionRepository
 * @Description TODO
 * @Author 非乐
 * @Date 2022/10/5 16:54
 * @Version 1.0
 **/
public interface PermissionRepository extends JpaRepository<Permission,Integer> {
    @Query(value = "select DISTINCT tp.permission_name from seller tu,role tr,permission tp,tb_seller_role tur,tb_role_permission trp where tu.id=tur.sellerid and tur.roleid=tr.id and tr.id = trp.roleid and trp.perid=tp.id and tu.username=?1",nativeQuery = true)
    List<String> selectPerNameByUserName(String userName);
}
